const setStorage = (options)=>{
  let promises = [];
  for (const key in options) {
    if (Object.hasOwnProperty.call(options, key)) {
      const value = options[key];
      let promise = new Promise((resolve,reject)=>{
        wx.setStorage({
          key:key,
          data:value,
          success(res){
            resolve(res);
          },
          fail(res){
            reject(res);
          }
        })
      })
      promises.push(promise);      
    }
  }
  return Promise.all(promises);
}

module.exports = {
  setStorage
}